// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   CheckRows.java

package include.alarm;

import include.nseer_db.nseer_db;
import java.sql.ResultSet;

public class CheckRows
{

	public CheckRows()
	{
	}

	public void addRowCount(String db_name, String tablename)
	{
		nseer_db db = new nseer_db(db_name);
		String sql = "";
		int count_row = 0;
		sql = (new StringBuilder("select count_row from erpPlatform_checkAlarm where tablename='")).append(tablename).append("'").toString();
		try
		{
			ResultSet rs = db.executeQuery(sql);
			if (rs.next())
				count_row = rs.getInt("count_row");
			count_row++;
			sql = (new StringBuilder("update erpPlatform_checkAlarm set count_row='")).append(count_row).append("' where tablename='").append(tablename).append("'").toString();
			db.executeUpdate(sql);
			db.close();
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
	}

	public void delRowCount(String db_name, String tablename)
	{
		nseer_db db = new nseer_db(db_name);
		String sql = "";
		int count_row = 0;
		sql = (new StringBuilder("select count_row from erpPlatform_checkAlarm where tablename='")).append(tablename).append("'").toString();
		try
		{
			ResultSet rs = db.executeQuery(sql);
			if (rs.next())
				count_row = rs.getInt("count_row");
			count_row--;
			sql = (new StringBuilder("update erpPlatform_checkAlarm set count_row='")).append(count_row).append("' where tablename='").append(tablename).append("'").toString();
			db.executeUpdate(sql);
			db.close();
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
	}
}
